package it.low.game.core.location;

import it.low.game.core.element.Element;

import java.awt.Rectangle;
import java.awt.geom.Area;
import java.util.HashSet;
import java.util.Set;

public class Map extends Rectangle {
	private static final long serialVersionUID = 1L;
	
	protected Set<Element> elements = null;
	
	public Map(){
		this.setSize(0,0);
		this.elements = new HashSet<Element>();
	}
	
	public void addElement(Element element){
		this.elements.add(element);
	}

	public Set<Element> getElements(Area area){
		Set<Element> elements = new HashSet<Element>(); 
		if(area!=null){
			for(Element element : this.elements){
				if(area.contains(element.getMapPosition())){
					elements.add(element);
				}
			}
		}
		return elements;
	}
	
}